// SystemParam.cpp: implementation of the CParam class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Param.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CParam::CParam()
{
}

CParam::~CParam()
{
}

int CParam::SaveFile(CStdioFileEx *pFile)
{
	CString strWriteString;
	strWriteString.Format(_T("<Parameter>"));
	CTool::WriteToCutFile(pFile,strWriteString);
	//SysParam
	m_sysPara.SaveFile(pFile);

	//IOParam
	m_ioPara.SaveFile(pFile);

	//LayParam
	m_layPara.SaveFile(pFile);

	//MoveParam
	m_movePara.SaveFile(pFile);

	//ViewParam
	m_viewPara.SaveFile(pFile);

	strWriteString.Format(_T("</Parameter>"));
	CTool::WriteToCutFile(pFile,strWriteString);
	return 0;
}

int CParam::OpenFile(CStdioFileEx* pFile)
{
	CString strStringData;
	while (pFile->ReadString(strStringData))
	{
		if (strStringData == _T("<SysParam>"))
		{
			m_sysPara.OpenFile(pFile);
		}
		else if (strStringData == _T("<IOParam>"))
		{
			m_ioPara.OpenFile(pFile);
		}
		else if (strStringData == _T("<LayParam>"))
		{
			m_layPara.OpenFile(pFile);
		}
		else if (strStringData == _T("<MoveParam>"))
		{
			m_movePara.OpenFile(pFile);
		}
		else if (strStringData == _T("<ViewParam>"))
		{
			m_viewPara.OpenFile(pFile);
		}
		else if (strStringData == _T("</Parameter>"))
		{
			break;
		}
	}
	return 0;
}

int CParam::ReadConfig()
{
	m_sysPara.ReadConfig();
	m_viewPara.ReadConfig();
	m_ioPara.ReadConfig();
	m_movePara.ReadConfig();
	m_layPara.ReadConfig();
	return 0;
}
int CParam::WriteConfig()
{
	m_sysPara.WriteConfig();
	m_viewPara.WriteConfig();
	m_ioPara.WriteConfig();
	m_movePara.WriteConfig();
	m_layPara.WriteConfig();
	return 0;
}

int CParam::operator=(const CParam& theParam)
{
 //	m_ioPara = theParam.m_ioPara;
 	m_viewPara = theParam.m_viewPara;
 	m_movePara = theParam.m_movePara;
 	m_layPara = theParam.m_layPara;
 	m_sysPara = theParam.m_sysPara;
	return 0;
}